/* 
 * Copyright (c) 2008 Knightsoft
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/
package com.knightsoft.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;

/**
 * Utilities to simplify generic container creation
 * by using type argument inference.
 * 
 * @version V1.0 Nov 08, 2008
 * @author Michael
 */
public class New {
	public static <K, V> Map<K, V> map() {
		return new HashMap<K, V>();
	}

	public static <T> List<T> list() {
		return new ArrayList<T>();
	}

	public static <T> LinkedList<T> lList() {
		return new LinkedList<T>();
	}

	public static <T> Set<T> set() {
		return new HashSet<T>();
	}

	public static <T> Queue<T> queue() {
		return new LinkedList<T>();
	}
	
	// Test:
	/*public static void main(String[] args) { 
		Map<String, List<String>> sls = New.map(); 
		Print.println(sls);
		List<String> ls = New.list();
		Print.println(ls);
		LinkedList<String> lls = New.lList();
		Print.println(lls);
		Set<String> ss = New.set();
		Print.println(ss);
		Queue<String> qs = New.queue();
		Print.println(qs);
	 }*/
	 
}
